package com.study.mybatis.mapper;

import com.study.mybatis.entity.StClass;

import java.util.List;
import org.apache.ibatis.annotations.*;

@Mapper
public interface StClassMapper {
    @Insert("INSERT INTO public.st_class(id, dept, \"name\") VALUES (#{id}, #{dept}, #{name})")
    void insert(StClass stClass);

    @Update("UPDATE public.st_class SET dept=#{dept}, \"name\"=#{name} WHERE id=#{id}")
    void update(StClass stClass);

    @Delete("DELETE FROM public.st_class WHERE id=#{id}")
    void deleteById(Integer id);

    @Select("SELECT * FROM public.st_class WHERE id=#{id} for update")
    StClass selectById(Integer id);

    @Select("SELECT * FROM public.st_class")
    List<StClass> selectAll();
}
